package com.ianmoone.JZOF;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import org.omg.PortableServer.LifespanPolicyOperations;

public class YonYoutest2 {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		String string = in.nextLine();
		String[] split = string.split(" ");
		int max=1;
		int start=0;
		int num = 1;
		for (int i = 1; i < split.length; i++) {
			if (Integer.valueOf(split[i-1])+1 == Integer.valueOf(split[i])) {
				num++;
			}else {
				num = 1;
			}
			if (num > max) {
				max = num;
				start = Integer.valueOf(split[i-max+1]);
			}
			
		}
		List<Integer> list = new ArrayList<>();
		list.add(start);
		list.add(max);
		System.out.println(list.toString());
	}
}
